<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>callLive</title>
    <link rel="stylesheet" href="../../model/jsFn.css">
</head>
<body>
<div class="catalog">
    <h1>目录</h1>
    <ul>
        <li>
            <p><a href="#profile">callLive</a></p>
            <ul>
                <li><p><a href="#jsFn_init">    init-------初始化</a></p></li>
                <li><p><a href="#jsFn_login">   login------登录</a></p></li>
                <li><p><a href="#jsFn_logout">  logout-----登出</a></p></li>
                <li><p><a href="#jsFn_call">    call-------发起会话</a></p></li>
                <li><p><a href="#jsFn_isLogin"> isLogin----是否登录</a></p></li>
            </ul>
        </li>
    </ul>
</div>
<div id="profile">
    <h2>对象简介:</h2>
    <p>提供腾讯云音视频聊天api;每一个appId都会在腾讯云内生成,并登录到腾讯云;所以在用户在app内退出登录时,需要开发者callLive.logout(),退出腾讯云的语音登录</p>
</div>
<div class="jsFnModel" id="jsFn_init">
    <h3>init:</h3>
    <div class="shape">
        <h3>函数使用样式</h3>
        <p>callLive.init([,options]) ->callLive</p>
    </div>
    <div class="profile">
        <h3>函数功能简介</h3>
        <p>初始化语音聊天服务</p>
    </div>
    <div class="version">
        <p>稳定性;2 - 稳定的</p>
        <p>新增于:v0.0.0</p>
    </div>
    <div class="params">
        <h3>参数列表:</h3>
        <ul>
            <li>
                <p>options</p>
                <p>&nbsp;object&nbsp;</p>
                <p>options.appId: 腾讯云语音账号SDKAPPID<br/>
                    options.accountType: 腾讯云语音accountType<br/>
                </p>
            </li>
        </ul>
    </div>
    <div class="res">
        <h3>返回值:</h3>
        <p>callLive</p>
        <p>返回本身</p>
    </div>
    <div class="code">
        <h3>例子</h3>
        <pre>
            <code>
                callLive.init({ appId: 1400076000, accountType: 12345});
            </code>
        </pre>
    </div>
    <div class="error">
        <h3>抛出错误</h3>
    </div>
</div>
<div class="jsFnModel" id="jsFn_login">
    <h3>login:</h3>
    <div class="shape">
        <h3>函数使用样式</h3>
        <p>callLive.login([callId,userSig]) ->promise</p>
    </div>
    <div class="profile">
        <h3>函数功能简介</h3>
        <p>登录音视频聊天</p>
    </div>
    <div class="version">
        <p>稳定性;2 - 稳定的</p>
        <p>新增于:v0.0.0</p>
    </div>
    <div class="params">
        <h3>参数列表:</h3>
        <ul>
            <li>
                <p>callId</p>
                <p>&nbsp;string&nbsp;</p>
                <p>登录账号,请和userSig一起在后台生成,再传给客户端</p>
            </li>
            <li>
                <p>userSig</p>
                <p>&nbsp;string&nbsp;</p>
                <p>登录有效唯一凭证,请和callId一起在后台生成,再传给客户端</p>
            </li>
        </ul>
    </div>
    <div class="res">
        <h3>返回值:</h3>
        <p>promise</p>
        <p>res()成功回调,rej(e)失败回调,e:失败信息</p>
    </div>
    <div class="code">
        <h3>例子</h3>
        <pre>
            <code>
                ServerAgent.invoke('callLiveLogin',{uid:1}).then(res=>{
                    callLive.login(res.callId,res.userSig).then(res=>{
                        console.log('登录成功');
                    }).catch(e=>{
                        console.log('登录失败');
                    });
                });
            </code>
        </pre>
    </div>
    <div class="error">
        <h3>抛出错误</h3>
    </div>
</div>
<div class="jsFnModel" id="jsFn_logout">
    <h3>logout:</h3>
    <div class="shape">
        <h3>函数使用样式</h3>
        <p>callLive.logout() ->promise</p>
    </div>
    <div class="profile">
        <h3>函数功能简介</h3>
        <p>退出音视频</p>
    </div>
    <div class="version">
        <p>稳定性;2 - 稳定的</p>
        <p>新增于:v0.0.0</p>
    </div>
    <div class="params">
        <h3>参数列表:</h3>
        <ul>
            <li>
                <p>无</p>
            </li>
        </ul>
    </div>
    <div class="res">
        <h3>返回值:</h3>
        <p>promise</p>
        <p>res()退出成功,rej()退出失败</p>
    </div>
    <div class="code">
        <h3>例子</h3>
        <pre>
            <code>
                callLive.logout().then(res=>{
                    console.log('退出成功');
                }).catch(res=>{
                    console.log('退出失败');
                })
            </code>
        </pre>
    </div>
    <div class="error">
        <h3>抛出错误</h3>
    </div>
</div>
<div class="jsFnModel" id="jsFn_call">
    <h3>call:</h3>
    <div class="shape">
        <h3>函数使用样式</h3>
        <p>callLive.call(options) ->promise</p>
    </div>
    <div class="profile">
        <h3>函数功能简介</h3>
        <p>给指定的callId发起音视频聊天请求</p>
    </div>
    <div style="background: #c3c363;" class="version">
        <p>稳定性;1 - 不稳定的</p>
        <p>新增于:v0.0.0</p>
    </div>
    <div class="params">
        <h3>参数列表:</h3>
        <ul>
            <li>
                <p>options</p>
                <p>&nbsp;object&nbsp;</p>
                <p>会话信息</p>
            </li>
            <li>
                <p>options.type</p>
                <p>&nbsp;string&nbsp;</p>
                <p>会话类型 audio|video ;默认audio</p>
            </li>
            <li>
                <p>options.callId</p>
                <p>&nbsp;string&nbsp;</p>
                <p>自己的callId/p>
            </li>
            <li>
                <p>options.info</p>
                <p>&nbsp;array&nbsp;</p>
                <p>参与会话的人的信息数组</p>
            </li>
            <li>
                <p>options.info[].callId</p>
                <p>&nbsp;string&nbsp;</p>
                <p>参与会话人的账号</p>
            </li>
            <li>
                <p>options.info[].name</p>
                <p>&nbsp;string&nbsp;</p>
                <p>参与会话人的昵称</p>
            </li>
            <li>
                <p>options.info[].img</p>
                <p>&nbsp;object&nbsp;</p>
                <p>参与会话人的头像</p>
            </li>
        </ul>
    </div>
    <div class="res">
        <h3>返回值:</h3>
        <p>promise</p>
        <p>res()接通,rej()没有接通;</p>
    </div>
    <div class="code">
        <h3>例子</h3>
        <pre>
            <code>
                let info = [
                    {name:"name1",img:"img1",callId:"callId1"},
                    {name:"name2",img:"img2",callId:"callId2"},
                    {name:"name3",img:"img3",callId:"callId3"},
                ];
                let selfCallId = "callId2";
                if(callLive.isLogin()){
                    callLive.call({callId:selfCallId,type:'audio',info}).then(res=>{
                        console.log('接通');
                    }).catch(e=>{
                        console.log('未接通');
                    });
                }else{
                    callLive.login(callId,userSig).then(res=>{
                        callLive.call({callId:selfCallId,type:'audio',info}).then(res=>{
                            console.log('接通');
                        }).catch(e=>{
                            console.log('未接通');
                        });
                    })
                }
            </code>
        </pre>
    </div>
    <div class="error">
        <h3>抛出错误</h3>
    </div>
</div>
<div class="jsFnModel" id="jsFn_isLogin">
    <h3>isLogin:</h3>
    <div class="shape">
        <h3>函数使用样式</h3>
        <p>callLive.isLogin() ->null</p>
    </div>
    <div class="profile">
        <h3>函数功能简介</h3>
        <p>获得登录状态</p>
    </div>
    <div class="version">
        <p>稳定性;2 - 稳定的</p>
        <p>新增于:v0.0.0</p>
    </div>
    <div class="params">
        <h3>参数列表:</h3>
        <ul>
            <li>
                <p>无</p>
            </li>
        </ul>
    </div>
    <div class="res">
        <h3>返回值:</h3>
        <p>无</p>
    </div>
    <div class="code">
        <h3>例子</h3>
        <pre>
            <code>
                if(callLive.isLogin()){
                    console.log("已经登录了");
                }else{
                    console.log('没有登录');
                }
            </code>
        </pre>
    </div>
    <div class="error">
        <h3>抛出错误</h3>
    </div>
</div>
<div class="author">
    <p>by-草草</p>
</div>
</body>
</html>